//
//  StarBaseViewController.m
//  taluo
//
//  Created by geng on 15-3-4.
//
//

#import "OABaseViewController.h"
@interface OABaseViewController ()

@end

@implementation OABaseViewController
@synthesize navBar,tableView=_tableView;

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _backgrundView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    _backgrundView.userInteractionEnabled=YES;
//    _backgrundView.backgroundColor=RGBColor(230, 232, 236, 1);
    _backgrundView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:_backgrundView];
    [self buildNavBar];
    // Do any additional setup after loading the view.
}

- (void)buildTables:(CGRect)frame andHeaderView:(UIView*)headerView andFooterView:(UIView*)footerView andAlwaysBounceVertical:(BOOL)isBounce Delegate:(id<UITableViewDelegate>)delegateVc DataSouce:(id<UITableViewDataSource>)dataVc
{
    _tableView=[[UITableView alloc]initWithFrame:frame style:UITableViewStylePlain];
    _tableView.backgroundColor=[UIColor clearColor];
    _tableView.alwaysBounceVertical=isBounce;
    _tableView.delegate=delegateVc;
    _tableView.dataSource=dataVc;
    if (headerView!=nil) {
        _tableView.tableHeaderView=headerView;
    }
    if (footerView!=nil) {
        _tableView.tableFooterView=footerView;
    }
    _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_tableView];
    
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleLightContent;
    [self.view bringSubviewToFront:self.navBar];
}

- (void)buildNavBar
{
    if (navBar==nil) {
        navBar = [[OANavigationView alloc] initWithFrame:
                  CGRectMake(0,0,SCREEN_WIDTH,HEADER_HEIGHT)];
        navBar.delegate = self;
    }
    [self.view addSubview:navBar];
    
}

//设置导航按钮图案
- (void)setNavBarleftBtn:(NSString *)lImg andlDimg:(NSString*)ldimag
                rightBtn:(NSString *)rImg andrImg:(NSString*)rdImg
                   title:(NSString *)content
{
    
    [navBar setleftBtn:lImg andlD:ldimag rightBtn:rImg andrD:rdImg title:content];
}

//设置导航按钮图案
- (void)setOpaquesNavBarleftBtn:(NSString *)lImg andlDimg:(NSString*)ldimag
                       rightBtn:(NSString *)rImg andrImg:(NSString*)rdImg
                          title:(NSString *)content
{
    
    [navBar setleftBtn:lImg andlD:ldimag rightBtn:rImg andrD:rdImg title:content];
    self.navBar.opaques=YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

#pragma mark -- navBar代理
- (void)leftBtnAction
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)rightBtnAction
{
    
}



- (UIStatusBarStyle)preferredStatusBarStyle
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    return UIStatusBarStyleLightContent;
#endif
    return UIStatusBarStyleDefault;
}
- (BOOL)prefersStatusBarHidden
{
    return NO;
}
- (void)dealloc
{
    _tableView =nil;
}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
